public class Student extends person {


    //专业
    private String subject;


    /**
     * 学习
     */
    public void  study(){
        //调用父类getName()方法
        System.out.println("学生" + super.getName() + "在学习" + subject);
    }

    //子类构造方法
    public Student (String name, int age,String gender ,String subject){
        //使用super调用person类的构造方法
        super(name,age,gender);
        //给自身赋值
        this.subject = subject;
    }

    public Student(){}

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }
}
